home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK2.toast / Development Kits (Disc 2) / QuickTime™ VR 2.0 SDK / Documentation + Extras / Updated Interfaces / QuickDraw 3D 1.5 Interfaces / Interfaces / QD3DDrawContext.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-22  |  14.6 KB  |  489 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DDrawContext.h                                         **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **     Purpose:    Draw context class types and routines                        **
  7.  **                                                                          **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1993-1996 Apple Computer, Inc. All rights reserved.     **
  11.  **                                                                          **
  12.  **                                                                          **
  13.  *****************************************************************************/
  14. #ifndef QD3DDrawContext_h
  15. #define QD3DDrawContext_h
  16.  
  17. #if defined(PRAGMA_ONCE) && PRAGMA_ONCE
  18.     #pragma once
  19. #endif  /*  PRAGMA_ONCE  */
  20.  
  21. #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  22.  
  23. #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  24.     #pragma options enum=small
  25. #endif
  26.     #include <Quickdraw.h>
  27.     #include <FixMath.h>
  28.     #include <GXTypes.h>
  29. #if defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  30.     #pragma options enum=reset
  31. #endif
  32.  
  33. #endif /* WINDOW_SYSTEM_MACINTOSH */
  34.  
  35. #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  36.     #include <X11/Xlib.h>
  37.     #include <X11/Xutil.h>
  38. #endif /* WINDOW_SYSTEM_X11 */
  39.  
  40. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  41.     #include <windows.h>
  42. /******************************************************************************
  43.  *                                                                             **
  44.  * ABOUT   QD3D_NO_DIRECTDRAW:     (Win32 Only)                                 **
  45.  *                                                                             **
  46.  * NOTE: Define QD3D_NO_DIRECTDRAW for your application makefile/project     **
  47.  *       only if you don't need Q3DDSurfaceDrawContext support and don't     **
  48.  *       have access to ddraw.h.                                             ** 
  49.  *                                                                             **
  50.  *****************************************************************************/
  51. #if !defined(QD3D_NO_DIRECTDRAW)
  52.     #include <ddraw.h>
  53. #endif /* !QD3D_NO_DIRECTDRAW */
  54. #endif  /*  WINDOW_SYSTEM_WIN32  */
  55.  
  56. #if defined(THINK_C) || defined(__SC__)
  57.     #pragma options(!pack_enums, !align_arrays)
  58.     #pragma SC options align=power
  59. #elif defined(__MWERKS__)
  60.     #pragma enumsalwaysint on
  61.     #pragma align_array_members off
  62.     #pragma options align=native
  63. #elif defined(__PPCC__)
  64.     #pragma options align=power
  65. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  66.     #pragma options enum=int
  67. #endif
  68.  
  69. #ifdef __cplusplus
  70. extern "C" {
  71. #endif /*  __cplusplus  */
  72.  
  73.  
  74. /******************************************************************************
  75.  **                                                                             **
  76.  **                            DrawContext Data Structures                         **
  77.  **                                                                             **
  78.  *****************************************************************************/
  79.  
  80. typedef enum TQ3DrawContextClearImageMethod{
  81.     kQ3ClearMethodNone,
  82. #if defined(ESCHER_VER_FUTURE) && ESCHER_VER_FUTURE
  83.     kQ3ClearMethodWithColor,
  84.     kQ3ClearMethodWithShader
  85. #else
  86.     kQ3ClearMethodWithColor
  87. #endif /* ESCHER_VER_FUTURE */
  88. } TQ3DrawContextClearImageMethod;
  89.  
  90.  
  91. typedef struct TQ3DrawContextData {
  92.     TQ3DrawContextClearImageMethod    clearImageMethod;
  93.     TQ3ColorARGB                    clearImageColor;
  94.     TQ3Area                            pane;
  95.     TQ3Boolean                        paneState;
  96.     TQ3Bitmap                        mask;
  97.     TQ3Boolean                        maskState;
  98.     TQ3Boolean                        doubleBufferState;
  99. } TQ3DrawContextData;
  100.  
  101.  
  102. /******************************************************************************
  103.  **                                                                             **
  104.  **                                DrawContext Routines                         **
  105.  **                                                                             **
  106.  *****************************************************************************/
  107.  
  108. QD3D_EXPORT TQ3ObjectType QD3D_CALL Q3DrawContext_GetType(
  109.     TQ3DrawContextObject        drawContext);
  110.  
  111. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetData(
  112.     TQ3DrawContextObject        context,
  113.     const TQ3DrawContextData    *contextData);
  114.  
  115. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetData(
  116.     TQ3DrawContextObject        context,
  117.     TQ3DrawContextData            *contextData);
  118.     
  119. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetClearImageColor(
  120.     TQ3DrawContextObject        context,
  121.     const TQ3ColorARGB             *color);
  122.  
  123. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetClearImageColor(
  124.     TQ3DrawContextObject        context,
  125.     TQ3ColorARGB                 *color);
  126.  
  127. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetPane(
  128.     TQ3DrawContextObject        context,
  129.     const TQ3Area                 *pane);
  130.  
  131. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetPane(
  132.     TQ3DrawContextObject        context,
  133.     TQ3Area                         *pane);
  134.  
  135. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetPaneState(
  136.     TQ3DrawContextObject        context,
  137.     TQ3Boolean                    state);
  138.  
  139. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetPaneState(
  140.     TQ3DrawContextObject        context,
  141.     TQ3Boolean                    *state);
  142.         
  143. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetClearImageMethod(
  144.     TQ3DrawContextObject            context,
  145.     TQ3DrawContextClearImageMethod     method);
  146.         
  147. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetClearImageMethod(
  148.     TQ3DrawContextObject            context,
  149.     TQ3DrawContextClearImageMethod     *method);
  150.         
  151. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetMask(
  152.     TQ3DrawContextObject        context,
  153.     const TQ3Bitmap                *mask);
  154.         
  155. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetMask(
  156.     TQ3DrawContextObject        context,
  157.     TQ3Bitmap                    *mask);
  158.  
  159. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetMaskState(
  160.     TQ3DrawContextObject        context,
  161.     TQ3Boolean                    state);
  162.  
  163. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetMaskState(
  164.     TQ3DrawContextObject        context,
  165.     TQ3Boolean                    *state);
  166.  
  167. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_SetDoubleBufferState(
  168.     TQ3DrawContextObject        context,
  169.     TQ3Boolean                     state);
  170.  
  171. QD3D_EXPORT TQ3Status QD3D_CALL Q3DrawContext_GetDoubleBufferState(
  172.     TQ3DrawContextObject        context,
  173.     TQ3Boolean                     *state);
  174.  
  175.  
  176. /******************************************************************************
  177.  **                                                                             **
  178.  **                            Pixmap Data Structure                             **
  179.  **                                                                             **
  180.  *****************************************************************************/
  181.  
  182. typedef struct TQ3PixmapDrawContextData {
  183.     TQ3DrawContextData        drawContextData;
  184.     TQ3Pixmap                pixmap;
  185. } TQ3PixmapDrawContextData;
  186.  
  187.  
  188. /******************************************************************************
  189.  **                                                                             **
  190.  **                        Pixmap DrawContext Routines                             **
  191.  **                                                                             **
  192.  *****************************************************************************/
  193.  
  194. QD3D_EXPORT TQ3DrawContextObject QD3D_CALL Q3PixmapDrawContext_New(
  195.     const TQ3PixmapDrawContextData    *contextData);
  196.  
  197. QD3D_EXPORT TQ3Status QD3D_CALL Q3PixmapDrawContext_SetPixmap(
  198.     TQ3DrawContextObject            drawContext,
  199.     const TQ3Pixmap                    *pixmap);
  200.  
  201. QD3D_EXPORT TQ3Status QD3D_CALL Q3PixmapDrawContext_GetPixmap(
  202.     TQ3DrawContextObject            drawContext,
  203.     TQ3Pixmap                        *pixmap);
  204.  
  205. #if defined(WINDOW_SYSTEM_MACINTOSH) && WINDOW_SYSTEM_MACINTOSH
  206.  
  207. /******************************************************************************
  208.  **                                                                             **
  209.  **                        Macintosh DrawContext Data Structures                 **
  210.  **                                                                             **
  211.  *****************************************************************************/
  212.  
  213. typedef enum TQ3MacDrawContext2DLibrary {
  214.     kQ3Mac2DLibraryNone,
  215.     kQ3Mac2DLibraryQuickDraw,
  216.     kQ3Mac2DLibraryQuickDrawGX
  217. } TQ3MacDrawContext2DLibrary;
  218.  
  219.  
  220. typedef struct TQ3MacDrawContextData {
  221.     TQ3DrawContextData            drawContextData;
  222.     CWindowPtr                    window;
  223.     TQ3MacDrawContext2DLibrary    library;
  224.     gxViewPort                    viewPort;
  225.     CGrafPtr                    grafPort;
  226. } TQ3MacDrawContextData;
  227.  
  228.  
  229. /******************************************************************************
  230.  **                                                                             **
  231.  **                        Macintosh DrawContext Routines                         **
  232.  **                                                                             **
  233.  *****************************************************************************/
  234.  
  235. QD3D_EXPORT TQ3DrawContextObject QD3D_CALL Q3MacDrawContext_New(
  236.     const TQ3MacDrawContextData    *drawContextData);
  237.     
  238. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_SetWindow(
  239.     TQ3DrawContextObject        drawContext,
  240.     const CWindowPtr            window);
  241.  
  242. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_GetWindow(
  243.     TQ3DrawContextObject        drawContext,
  244.     CWindowPtr                    *window);
  245.  
  246. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_SetGXViewPort(
  247.     TQ3DrawContextObject        drawContext,
  248.     const gxViewPort            viewPort);
  249.  
  250. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_GetGXViewPort(
  251.     TQ3DrawContextObject        drawContext,
  252.     gxViewPort                    *viewPort);
  253.  
  254. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_SetGrafPort(
  255.     TQ3DrawContextObject        drawContext,
  256.     const CGrafPtr                grafPort);
  257.  
  258. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_GetGrafPort(
  259.     TQ3DrawContextObject        drawContext,
  260.     CGrafPtr                    *grafPort);
  261.  
  262. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_Set2DLibrary(
  263.     TQ3DrawContextObject        drawContext,
  264.     TQ3MacDrawContext2DLibrary    library);
  265.  
  266. QD3D_EXPORT TQ3Status QD3D_CALL Q3MacDrawContext_Get2DLibrary(
  267.     TQ3DrawContextObject        drawContext,
  268.     TQ3MacDrawContext2DLibrary    *library);
  269.  
  270. #endif /* WINDOW_SYSTEM_MACINTOSH */
  271.  
  272. #if defined(WINDOW_SYSTEM_X11) && WINDOW_SYSTEM_X11
  273.  
  274. /******************************************************************************
  275.  **                                                                             **
  276.  **                                Types                                         **
  277.  **                                                                             **
  278.  *****************************************************************************/
  279.  
  280. typedef struct TQ3XBufferData *TQ3XBufferObject;
  281.  
  282. typedef struct TQ3XColormapData {
  283.     long        baseEntry;
  284.     long        maxRed;
  285.     long        maxGreen;
  286.     long        maxBlue;
  287.     long        multRed;
  288.     long        multGreen;
  289.     long        multBlue;
  290. } TQ3XColormapData;
  291.  
  292.  
  293. typedef struct TQ3XDrawContextData {
  294.     TQ3DrawContextData        contextData;
  295.     Display                    *display;
  296.     Drawable                drawable;
  297.     Visual                    *visual;
  298.     Colormap                cmap;
  299.     TQ3XColormapData        *colorMapData;
  300. } TQ3XDrawContextData;
  301.  
  302.  
  303. /******************************************************************************
  304.  **                                                                             **
  305.  **                            XDrawContext Routines                             **
  306.  **                                                                             **
  307.  *****************************************************************************/
  308.  
  309. #ifdef XDC_OLD
  310. QD3D_EXPORT TQ3DrawContextObject QD3D_CALL Q3XDrawContext_New(
  311.     void);
  312.  
  313. QD3D_EXPORT void QD3D_CALL Q3XDrawContext_Set(
  314.     TQ3DrawContextObject    drawContext,
  315.     unsigned long            flag,                             
  316.     void                    *data);
  317.  
  318. QD3D_EXPORT void QD3D_CALL Q3XDrawContext_Get(
  319.     TQ3DrawContextObject    drawContext,
  320.     unsigned long            flag,                             
  321.     void                    *data);
  322. #endif  /* XDC_OLD */
  323.  
  324. QD3D_EXPORT TQ3XBufferObject QD3D_CALL Q3XBuffers_New(
  325.     Display                    *dpy,                       
  326.     unsigned long            numBuffers,
  327.     Window                    window);
  328.  
  329. QD3D_EXPORT void QD3D_CALL Q3XBuffers_Swap(
  330.     Display                    *dpy,
  331.     TQ3XBufferObject        buffers);
  332.  
  333. QD3D_EXPORT XVisualInfo *QD3D_CALL Q3X_GetVisualInfo(
  334.     Display                    *dpy,
  335.     Screen                    *screen);
  336.  
  337.  
  338. QD3D_EXPORT TQ3DrawContextObject QD3D_CALL Q3XDrawContext_New(
  339.     const TQ3XDrawContextData    *xContextData);
  340.  
  341. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_SetDisplay(
  342.     TQ3DrawContextObject        drawContext,
  343.     const Display                *display);
  344.  
  345. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_GetDisplay(
  346.     TQ3DrawContextObject        drawContext,
  347.     Display                        **display);
  348.  
  349. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_SetDrawable(
  350.     TQ3DrawContextObject        drawContext,
  351.     Drawable                    drawable);
  352.  
  353. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_GetDrawable(
  354.     TQ3DrawContextObject        drawContext,
  355.     Drawable                    *drawable);
  356.  
  357. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_SetVisual(
  358.     TQ3DrawContextObject        drawContext,
  359.     const Visual                *visual);
  360.  
  361. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_GetVisual(
  362.     TQ3DrawContextObject        drawContext,
  363.     Visual                        **visual);
  364.  
  365. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_SetColormap(
  366.     TQ3DrawContextObject        drawContext,
  367.     Colormap                    colormap);
  368.  
  369. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_GetColormap(
  370.     TQ3DrawContextObject        drawContext,
  371.     Colormap                    *colormap);
  372.  
  373. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_SetColormapData(
  374.     TQ3DrawContextObject        drawContext,
  375.     const TQ3XColormapData        *colormapData);
  376.  
  377. QD3D_EXPORT TQ3Status QD3D_CALL Q3XDrawContext_GetColormapData(
  378.     TQ3DrawContextObject        drawContext,
  379.     TQ3XColormapData            *colormapData);
  380.  
  381. #endif /* WINDOW_SYSTEM_X11 */
  382.  
  383. #if defined(WINDOW_SYSTEM_WIN32) && WINDOW_SYSTEM_WIN32
  384.  
  385. /******************************************************************************
  386.  **                                                                             **
  387.  **                                Types                                         **
  388.  **                                                                             **
  389.  *****************************************************************************/
  390.  
  391. typedef struct TQ3Win32DCDrawContextData {
  392.     TQ3DrawContextData        drawContextData;
  393.     HDC                        hdc;
  394. } TQ3Win32DCDrawContextData;
  395.  
  396. #if !defined(QD3D_NO_DIRECTDRAW)
  397.  
  398. typedef enum {
  399.     kQ3DirectDrawObject        = 1,
  400.     kQ3DirectDrawObject2    = 2
  401. } TQ3DirectDrawObjectSelector;
  402.  
  403. typedef enum {
  404.     kQ3DirectDrawSurface    = 1,
  405.     kQ3DirectDrawSurface2    = 2
  406. } TQ3DirectDrawSurfaceSelector;
  407.  
  408. typedef struct TQ3DDSurfaceDescriptor {
  409.     TQ3DirectDrawObjectSelector        objectSelector;
  410.     union
  411.     {
  412.         LPDIRECTDRAW                lpDirectDraw;
  413.         LPDIRECTDRAW2                lpDirectDraw2;
  414.     };
  415.  
  416.     TQ3DirectDrawSurfaceSelector    surfaceSelector;
  417.     union
  418.     {
  419.         LPDIRECTDRAWSURFACE            lpDirectDrawSurface;
  420.         LPDIRECTDRAWSURFACE2        lpDirectDrawSurface2;
  421.     };
  422. } TQ3DDSurfaceDescriptor;
  423.  
  424. typedef struct TQ3DDSurfaceDrawContextData {
  425.     TQ3DrawContextData                drawContextData;
  426.     TQ3DDSurfaceDescriptor            ddSurfaceDescriptor;
  427. } TQ3DDSurfaceDrawContextData;
  428.  
  429. #endif /* !QD3D_NO_DIRECTDRAW */
  430.  
  431. /******************************************************************************
  432.  **                                                                             **
  433.  **                            Win32DC DrawContext Routines                     **
  434.  **                                                                             **
  435.  *****************************************************************************/
  436.  
  437. QD3D_EXPORT TQ3DrawContextObject QD3D_CALL Q3Win32DCDrawContext_New(
  438.     const TQ3Win32DCDrawContextData    *drawContextData);
  439.  
  440. QD3D_EXPORT TQ3Status QD3D_CALL Q3Win32DCDrawContext_SetDC(
  441.     TQ3DrawContextObject        drawContext,
  442.     const HDC                    hdc);
  443.  
  444. QD3D_EXPORT TQ3Status QD3D_CALL Q3Win32DCDrawContext_GetDC(
  445.     TQ3DrawContextObject        drawContext,
  446.     HDC                            *hdc);
  447.  
  448.  
  449. /******************************************************************************
  450.  **                                                                             **
  451.  **                            DDSurface DrawContext Routines                     **
  452.  **                                                                             **
  453.  *****************************************************************************/
  454. #if !defined(QD3D_NO_DIRECTDRAW)
  455.  
  456. QD3D_EXPORT TQ3DrawContextObject QD3D_CALL Q3DDSurfaceDrawContext_New(
  457.     const TQ3DDSurfaceDrawContextData    *drawContextData);
  458.  
  459. QD3D_EXPORT TQ3Status QD3D_CALL Q3DDSurfaceDrawContext_SetDirectDrawSurface(
  460.     TQ3DrawContextObject            drawContext,
  461.     const TQ3DDSurfaceDescriptor    *ddSurfaceDescriptor);
  462.  
  463. QD3D_EXPORT TQ3Status QD3D_CALL Q3DDSurfaceDrawContext_GetDirectDrawSurface(
  464.     TQ3DrawContextObject        drawContext,
  465.     TQ3DDSurfaceDescriptor        *ddSurfaceDescriptor);
  466.  
  467. #endif /* !QD3D_NO_DIRECTDRAW */
  468.  
  469. #endif  /*  WINDOW_SYSTEM_WIN32  */
  470.  
  471.  
  472. #ifdef __cplusplus
  473. }
  474. #endif /*  __cplusplus  */
  475.  
  476. #if defined(THINK_C) || defined(__SC__)
  477.     #pragma SC options align=reset
  478. #elif defined(__MWERKS__)
  479.     #pragma enumsalwaysint reset
  480.     #pragma align_array_members reset
  481.     #pragma options align=reset
  482. #elif  defined(__PPCC__)
  483.     #pragma options align=reset
  484. #elif defined(__xlc) || defined(__xlC) || defined(__xlC__) || defined(__XLC121__)
  485.     #pragma options enum=reset
  486. #endif
  487.  
  488. #endif  /*  QD3DDrawContext_h  */
  489.